Setting the Font Family

You can specify a list of font names for the text contained inside an HYML element, using the font-family property. This property is used to add more than one font family names such as arial, sans-serif, and times new roman. With the use of this property, it gives the browser the flexibility to choose other fonts from the font family names; on case the first font specifies in the list is not present on user’s computer.

Let’s do the following steps to set a font family for the text present on an HTML Web page:


<!DOCTYPE html>
<html>
<head>
<title>Setting the Font Family</title>
    <style type=”text/css”>
    body{font-family: Palatino, Arial, Magneto}
    </style>
</head>
<body>
<h2>The syntax of CSS is lightly different from that of HYML. In contrast to the angle brackets, equal sign, and quotation marks found in HTML syntax, CSS syntax contains curly braces, colon, and semicolon.</h2>

</body>
</html> 

Save the document with a suitable name and .html extension. In this case, we have named the document as FontFamily.html and open on browser.